package com.demo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.demo.pojo.entity.ClazzTeacher;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 班级-教师关联Mapper接口
 */
@Mapper
public interface ClazzTeacherMapper extends BaseMapper<ClazzTeacher> {
    
    /**
     * 根据班级ID查询关联的教师列表
     * @param clazzId 班级ID
     * @return 教师ID列表
     */
    @Select("SELECT teacher_id FROM clazz_teacher WHERE clazz_id = #{clazzId}")
    List<Long> getTeacherIdsByClazzId(@Param("clazzId") Long clazzId);
    
    /**
     * 根据教师ID查询关联的班级列表
     * @param teacherId 教师ID
     * @return 班级ID列表
     */
    @Select("SELECT clazz_id FROM clazz_teacher WHERE teacher_id = #{teacherId}")
    List<Long> getClazzIdsByTeacherId(@Param("teacherId") Long teacherId);
}

